import os
import time

from selenium.webdriver.common.by import By

from base.Base import Base


class Page(Base):
    updown_url = os.getenv('base_url')
    #点击相机 class="soutu-btn"
    camera_loc = (By.CLASS_NAME, 'soutu-btn')
    #点击上传文件
    updown_file_loc = (By.CLASS_NAME, 'upload-pic')
    #断言
    dy_loc=(By.CLASS_NAME,'general-title')
    def camera(self):
        self.click(self.camera_loc)

    def updown_file(self):
        self.find_element(self.updown_file_loc).send_keys(r"C:\Users\jing\Pictures\姐妹\微信图片_20250523192840.png")

    #断言
    def dy(self):
        self.get_text(self.dy_loc)
    def updown_file_luoji(self):
        self.open_url(self.updown_url)
        self.camera()
        time.sleep(3)
        #上传文件
        self.updown_file()
        time.sleep(15)
        pr=self.dy()
        print(self.dy)
        assert "相关商品" == pr

